package com.bawei.composeui2207a.day01

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

/**
 * 作者：赵亮
 * 时间：2024/12/10 12:19
 * 功能：演示行和列的使用
 */
@Composable
fun Demo01() {
    Column(
        modifier = Modifier
            .background(color = Color.Blue)                     // 背景
            .fillMaxSize(),                                     // 宽度大小
        verticalArrangement = Arrangement.SpaceAround,          // 纵轴排列方式
        horizontalAlignment = Alignment.CenterHorizontally      // 横轴排列方式
    ) {
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Text(text = "Hello 2207A")
        Row(
            modifier = Modifier
                .background(color = Color.Green)
                .fillMaxWidth()
                .height(100.dp),                                // 高度
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.SpaceAround
        ) {
            Text(text = "1")
            Text(text = "2")
            Text(text = "3")
            Text(text = "4")
            Text(text = "5")
            Text(text = "6")
        }
    }
}

@Preview(showSystemUi = true)
@Composable
fun PreviewPage1() {
    Demo01()
}